home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / os2 / nftp102.zip / BMKCONV.CMD next >
OS/2 REXX Batch file  |  1997-04-16  |  3KB  |  85 lines

  1. /* REXX 
  2.  
  3.    bmkconv <old-bookmark-file> <new-bookmark-file>
  4.  
  5.    converts bookmark file from old format (.mrk) into new one (.bmk)
  6.  
  7. */
  8.  
  9. parse arg oldlist newlist garbage
  10.  
  11. if (newlist = "" ) | (garbage <> "") then signal usage
  12.  
  13. /* Load RexxUtil extensions */
  14. if RxFuncQuery("SysLoadFuncs") then do
  15.     call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
  16.     if result \= "0" then do
  17.         say "error loading RexxUtil.dll"
  18.         exit
  19.     end
  20.     call SysLoadFuncs
  21. end
  22.  
  23. say
  24. say "Converting" oldlist "into" newlist"..."
  25. call SysFileDelete newlist
  26. rc = lineout(newlist, "; generated by bmk-conv")
  27. rc = lineout(newlist, "")
  28. rc = lineout(newlist, "[General sites]")
  29.  
  30. signal off notready
  31. countgen = 0
  32. countos2 = 0
  33.  
  34. do forever
  35.     
  36.     bookmark = linein(oldlist)
  37.     if bookmark = "" then leave
  38.     
  39.     /* parse old format */
  40.     parse value bookmark with login site" : "initdir
  41.     /*if (substr(initdir, 1, 1) <> "/") then initdir = "/"initdir*/
  42.     if (initdir = "") | (site = "") then iterate
  43.     /*say "|"login"|"site"|"initdir"|"*/
  44.  
  45.     /* attempt to guess description for some well-known sites */
  46.     desc = ""
  47.     tsite = translate(site)
  48.     if (tsite = "HOBBES.NMSU.EDU") | (tsite = "FTP-OS2.NMSU.EDU") then ,
  49.         desc = "Hobbes: the biggest place for OS/2 material on the Internet"
  50.     if (tsite = "FTP.CDROM.COM") | (tsite = "FTP-OS2.CDROM.COM") then ,
  51.         desc = "Walnut Creek CDROM archive"
  52.     if (tsite = "FTP.LEO.ORG") then ,
  53.         desc = "LEO - Link Everything Online, Germany"
  54.     if (tsite = "SERVICE.BOULDER.IBM.COM") | (tsite = "FTP.SOFTWARE.IBM.COM") then ,
  55.         desc = "IBM: primary ftp server for OS/2-related files"
  56.     if (tsite = "FTP.SAI.MSU.SU") then ,
  57.         desc = "SAI software archive, Moscow"
  58.  
  59.     /* create new format */
  60.     newbookmark = site":"initdir" : "login"// : "desc
  61.     rc = lineout(newlist, newbookmark)
  62.     
  63.     /* converted successfully */
  64.     countgen = countgen + 1
  65.  
  66.     /* check for the end of file */
  67.     if stream(oldlist) <> "READY" then leave
  68.     
  69. end
  70. rc = lineout(newlist, "")
  71.  
  72. say countgen "entries were converted and placed into [General sites] folder"
  73. /*say countos2 "entries were converted and placed into [OS/2-related sites] folder"*/
  74.  
  75. exit 0
  76.  
  77. usage:
  78.     
  79.     say
  80.     say "Usage: bmkconv <old-bookmark-file> <new-bookmark-file>"
  81.     say "Converts bookmark file from old format (.mrk) into new one (.bmk)."
  82.     say "Both parameters are obligatory."
  83.  
  84.     exit 1
  85.